package info.hexin.jj;

import java.io.File;
import java.net.URL;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.webapp.WebAppContext;

public class Main {
    public static void main(String[] args) throws Exception {
        Server server = new Server();
        SelectChannelConnector ret = new SelectChannelConnector();
        ret.setAcceptQueueSize(128);
        ret.setResolveNames(false);
        ret.setUseDirectBuffers(false);
        ret.setHost("0.0.0.0");
        ret.setPort(8080);
        server.addConnector(ret);
        WebAppContext context = new WebAppContext();
        context.setContextPath("/");

        URL url = Main.class.getClassLoader().getResource("");
        File file = new File(new File(url.getPath()).getParentFile(), "webapps");
        context.setResourceBase(file.getAbsolutePath());
        server.setHandler(context);
        server.start();
    }
}
